package com.eastfair.auth.api;

import com.eastfair.annotation.annotation.base.BaseControllerInfo;
import com.eastfair.auth.dto.OrganizationDTO;
import com.eastfair.auth.dto.OrganizationRoleDto;
import com.eastfair.auth.dto.UserAccountDto;
import com.eastfair.auth.dto.UserOrganizationDTO;
import com.eastfair.auth.entity.Organization;
import com.eastfair.auth.entity.UserAccount;
import com.eastfair.auth.entity.UserOrganization;
import com.eastfair.auth.hystrix.AuthApiFallback;
import com.eastfair.auth.vo.ResourceOrganizationVo;
import com.eastfair.auth.vo.UserAccountVo;
import com.eastfair.core.base.R;
import com.eastfair.core.context.ContextUtil;
import com.eastfair.projectcore.entity.ProjectDb;
import com.eastfair.vo.VoGroupClass;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * auth feign接口
 *
 * @Author ligang
 * @Date 2021/7/16 16:41
 */
@FeignClient(name = "auth", fallback = AuthApiFallback.class)
public interface AuthServiceFeign {

    /**
     * 添加用户到观众分类
     *
     * @param organizationDTO
     * @return
     */
    @PutMapping("/audienceOrganization/addUserOfAudience")
    R addUserOfAudience(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 添加公司
     *
     * @param organizationDTO 公司节点参数
     * @return
     */
    @PostMapping("/companyOrganization/addCompany")
    R<Organization> addCompany(@RequestBody OrganizationDTO organizationDTO);

    /**
     * 修改公司
     * @param organizationDTO 组织实体DTO
     * @return
     */
    @PostMapping("/companyOrganization/updCompany")
    R<Organization> updCompany(@RequestBody OrganizationDTO organizationDTO);

//    /**
//     * 剔除公司管理员
//     * @param organizationDTO  resourceId 资源id
//     * @return
//     */
//    @PostMapping("/companyOrganization/breakUseridOfCompany")
//    R breakUseridOfCompany(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 修改公司超级管理员
     *
     * @param organizationDTO resourceId 资源id userId 账户用户id
     * @return
     */
    @PostMapping("/companyOrganization/updUseridOfCompany")
    R updUseridOfCompany(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 剔除公司员工
     *
     * @param organizationDTO resourceId 资源id userIds 账户用户id集合
     * @return
     */
    @PostMapping("/companyOrganization/removeUseridOfCompany")
    R removeUseridOfCompany(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 添加公司员工
     *
     * @param organizationDTO resourceId 资源id userIds 账户用户id集合
     * @return
     */
    @PostMapping("/companyOrganization/addUseridOfCompany")
    R addUseridOfCompany(@RequestBody OrganizationDTO organizationDTO);



    /**
     * 创建展会
     *
     * @param organizationDTO 实体
     *                        orgType 节点类型
     *                        name 节点名称
     *                        parentId 父级节点id
     *                        resourceId 资源id
     *                        resourceType 资源类型
     * @return
     */
    @PostMapping("/exhibitionOrganization/createExhibition")
    R<Organization> createExhibition(@RequestBody OrganizationDTO organizationDTO);



    /**
     * 修改展会
     *
     * @param organizationDTO 实体
     *                        orgType 节点类型
     *                        name 节点名称
     *                        parentId 父级节点id
     *                        resourceId 资源id
     *                        resourceType 资源类型
     * @return
     */
    @PostMapping("/exhibitionOrganization/updExhibition")
    R<Organization> updExhibition(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 添加公司到展商
     *
     * @param organizationDTO 组织节点实体
     *                        name 公司名称
     *                        resourceId 公司资源id
     *                        targetResourceId  目标资源id，如会展id
     * @return
     */
    @PostMapping("/exhibitionOrganization/addCompany")
    R addCompanyOfExhibition(@RequestBody OrganizationDTO organizationDTO);




    /**
     * 剔除展商下的公司
     *
     * @param organizationDTO 组织节点实体
     *                        resourceId 公司资源id
     *                        targetResourceId  目标资源id，如会展id
     * @return
     */
    @PostMapping("/exhibitionOrganization/removeCompany")
    R removeCompanyOfExhibition(@RequestBody OrganizationDTO organizationDTO);

    /**
     * 剔除公司的展商员工
     *
     * @param organizationDTO 实体
     *                        resourceId 资源id
     *                        userIds 剔除用户id
     * @return
     */
    @PostMapping("/exhibitionOrganization/removeUseridOfExhibitionCompany")
    R removeUseridOfExhibitionCompany(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 添加公司的展商员工
     *
     * @param organizationDTO 实体
     *                        resourceId 资源id
     *                        userIds 用户id
     * @return
     */
    @PostMapping("/exhibitionOrganization/addUseridOfExhibitionCompany")
    R addUseridOfExhibitionCompany(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 熔断测试
     *
     * @return
     */
    @GetMapping("/organization/test")
    R test(@RequestParam(value = "id") Long id);


    /**
     * 创建项目
     *
     * @param organizationDTO 实体
     * @return
     */
    @PostMapping("/projectOrganization/createProject")
    R<Organization> createProject(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 修改项目
     *
     * @param organizationDTO 实体
     * @return
     */
    @PostMapping("/projectOrganization/updProject")
    R<Organization> updProjectOrganization(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 添加组织关联角色
     *
     * @param orgRoleDto 组织角色实体
     * @return
     */
    @PostMapping("/organization/addOrgRole")
    R addOrgRole(@RequestBody OrganizationRoleDto orgRoleDto);


    /**
     * 更新组织关联角色
     *
     * @param orgRoleDto 组织角色实体
     * @return
     */
    @PostMapping("/organization/updOrgRole")
    R updOrgRole(@RequestBody OrganizationRoleDto orgRoleDto);


    /**
     * 通过资源查询角色Id集合
     *
     * @param resourceId 资源id
     * @return
     */
    @ApiOperation(value = "通过资源查询角色Id集合", notes = "通过资源查询角色Id集合")
    @GetMapping("/organization/queryRoleOfResourceId")
    R<List<Long>> queryRoleOfResourceId(@RequestParam("resourceId") Long resourceId);

    /**
     * 查询资源指定节点下的组织Id集合
     * @param resourceId 资源id
     * @param orgId 指定节点id
     * @return
     */
    @ApiOperation(value = "查询资源指定节点下的组织Id集合", notes = "查询资源指定节点下的组织Id集合")
    @GetMapping("/organization/queryRoleOfOrgId")
    R<List<Long>> queryOrgOfResourceId(@RequestParam("resourceId") Long resourceId,@RequestParam("orgId") Long orgId);
    /**
     * 添加用户到组织
     *
     * @param userOrganizationDTO 用户组织实体
     * @return
     */
    @ApiOperation(value = "添加用户到组织", notes = "添加用户到组织")
    @PostMapping("/userOrganization/addUserOfOrg")
    R<UserOrganization> addUserOfOrg(@RequestBody UserOrganizationDTO userOrganizationDTO);



    /**
     * 查询 项目下的类型节点信息
     * @param organizationDTO
     * @return
     */
    @ApiOperation(value = "查询资源指定节点下的组织Id集合", notes = "查询资源指定节点下的组织Id集合")
    @PostMapping("/organization/queryOrgOfType")
    R<Organization> queryOrgOfType(@RequestBody OrganizationDTO organizationDTO);


    /**
     * 通过组织查询资源
     * @param orgIds 组织id
     * @return
     */
    @ApiOperation(value = "通过组织查询资源", notes = "通过组织查询资源")
    @GetMapping("/resourceOrganization/queryResource")
    R<List<ResourceOrganizationVo>> queryResource(@RequestParam("orgIds") List<Long> orgIds);

    @ApiOperation(value = "通过组织查询资源ID", notes = "通过组织查询资源ID")
    @GetMapping("/resourceOrganization/queryResourceId")
    R<List<Long>> queryResourceId(@RequestParam("orgIds") List<Long> orgIds);


    /**
     * 查询资源所在的指定组织里的信息
     *
     * @param orgIds 组织id
     * @return
     */
    @ApiOperation(value = "查询资源所在的指定组织里的信息", notes = "查询资源所在的指定组织里的信息")
    @GetMapping("/organization/queryOrgOfResource")
    R<Map<Long,List<Organization>>> queryOrgOfResource(@RequestParam("resourceIds") List<Long> resourceIds, @RequestParam("orgIds") List<Long> orgIds);





    /**
     * 查询用户权限信息，用于接口判断
     * @param userIds
     * @return
     */
    @ApiOperation(value = "查询用户权限信息", notes = "查询用户权限信息")
    @GetMapping("/organization/loadUserPermission")
    R<List<Map>> loadUserPermission(@RequestParam("userIds") List<Long> userIds);




    /**
     * 根据组织查询用户的权限信息，用于接口判断
     * @param orgIds
     * @return
     */
    @ApiOperation(value = "根据组织查询用户的权限信息", notes = "查询用户权限信息")
    @GetMapping("/organization/loadUserPermissionOfOrg")
    R<List<Map>> loadUserPermissionOfOrg(@RequestParam("orgIds") List<Long> orgIds);

    /**
     * 根据角色查组织进而查询用户的权限信息，用于接口判断
     * @param roleIds
     * @return
     */
    @ApiOperation(value = "根据角色查组织进而查询用户的权限信息", notes = "根据角色查组织进而查询用户的权限信息")
    @GetMapping("/organization/loadUserPermissionOfRole")
    R<List<Map>> loadUserPermissionOfRole(@RequestParam("roleIds") List<Long> roleIds);

}
